<?php
$x_size=80;
$y_size=60;
$im=imagecreate($x_size, $y_size);

$background_color=imagecolorallocate($im, 255, 255, 255);
$text_color=imagecolorallocate($im, 0, 0, 0);
putenv('GDFONTPATH=/usr/share/fonts/truetype/wqy');
imagettftext($im, 20, 0, 20, 30, $text_color, "wqy-microhei.ttc", "你好");
imagepng($im, "test.png");

for($y=0; $y<$y_size; ++$y)
{
    for($x=0; $x<$x_size; ++$x)
    {
        $rgb=ImageColorAt($im, $x, $y);
        print $rgb;
        $r=($rgb >> 16) & 0xFF;
        $g=($rgb >> 8) & 0xFF;
        $b=$rgb & 0xFF;
    }
    print "\n";
}

imagedestroy($im);
?>
